<template>
	<view class="bookListBox">
		<bookList :bookInfo="bookLists"></bookList>
		<uni-load-more :status="loadStatus"></uni-load-more>
	</view>
</template>

<script>
	import bookList from '../../../components/bookList.vue'
	import key from '@/common/key.js';
	import utils from '@/common/utils.js';
	import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue"

	export default {
		data() {
			return {
				bookLists: [],
				page: 1,
				lanmu_id: 0,
				loadStatus: 'noMore',
				last_page: 0
			}
		},
		onLoad() {
			let data = uni.getStorageSync('lookeds')
			if (data.length != 0) {
				data.forEach((item, index, arr) => {
					item.name = item.book_name
					item.id = item.book_id
				})
				console.log(data);
				this.bookLists.push(data)
			}
		},
		onReachBottom() {
			if (this.page < this.last_page + 1) {
				this.getBookList(this.lanmu_id, this.page)
			} else {
				this.loadStatus = 'noMore'
			}

		},
		components: {
			bookList,
			uniLoadMore
		},
	}
</script>

<style>
	.bookListBox {
		padding: 30upx 0;
	}
</style>
